/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Module Name          : com.yaodian100.ec.product.entity.AddOnProduct
   Module Description   :

   Date Created      : 2009/12/15
   Original Author   : ellen.li
   Team              : yaodian100
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   MODIFICATION HISTORY
   ------------------------------------------------------------------------------
   Date Modified       Modified by       Comments
   ------------------------------------------------------------------------------
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
package com.yaodian100.ec.product.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlTransient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.yaodian100.core.common.entity.BaseEntity;

/**
 * @author ellen.li 搭售 / 加價購 / 贈品 / 加一元多一件
 */
@Entity
@Table(name = "EC_ADDON_PRODUCT")
public class AddOnProduct extends BaseEntity {

	/**
	 * serial version
	 */
	private static final long serialVersionUID = 3987241043370561747L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_ec_addon_product")
	@SequenceGenerator(name = "seq_ec_addon_product", sequenceName = "SEQ_EC_ADDON_PRODUCT")
	@Column(name = "ADDON_ID")
	private Long addonId;

	/**
	 * 主商品編號
	 */
	@Column(name = "MAIN_PRODUCT_ID", nullable = false, length = 8)
	private String mainProductId;

	@XmlTransient
	@NotFound(action = NotFoundAction.IGNORE)
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MAIN_PRODUCT_ID", insertable = false, updatable = false)
	private Product product;

	/**
	 * 可搭售/加購之商品編號
	 */
	@Column(name = "ADDON_PRODUCT_ID", nullable = false, length = 8)
	private String addOnProductId;

	@XmlTransient
	@NotFound(action = NotFoundAction.IGNORE)
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ADDON_PRODUCT_ID", insertable = false, updatable = false)
	private Product addProduct;

	/**
	 * 搭售 / 加價購 / 贈品說明文字
	 */
	@Column(name = "ADDON_DESC", length = 200)
	private String addOnDesc;

	/**
	 * 搭售/加購之销售價格
	 */
	@Column(name = "ADDON_PRICE", nullable = false, columnDefinition = "NUMERIC(10, 2)")
	private BigDecimal addOnPrice;

	/**
	 * 適用會員等級(00: 一般會員 ,10: 銀卡,50: 金卡,90: 鉆卡)
	 */
	@Column(name = "APPLY_MEMBER_RANK", length = 2, nullable = false)
	private String applyMemberRank;

	/**
	 * 是否啟用是: Y; 否: N
	 */
	@Column(name = "IS_ENABLE", length = 1, nullable = false)
	private String isEnable;

	/**
	 * 是否已刪除,default=N
	 */
	@Column(name = "IS_DELETE", length = 1)
	private String isDelete;

	/**
	 * 有效起始日期 Start Date
	 */
	@Column(name = "START_DATE", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date startDate;

	/**
	 * 有效結束日期 END Date
	 */
	@Column(name = "END_DATE", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date endDate;

	/**
	 * @return the addonId
	 */
	public Long getAddonId() {
		return addonId;
	}

	/**
	 * @param addonId the addonId to set
	 */
	public void setAddonId(Long addonId) {
		this.addonId = addonId;
	}

	/**
	 * @return the addOnDesc
	 */
	public String getAddOnDesc() {
		return addOnDesc;
	}

	/**
	 * @param addOnDesc the addOnDesc to set
	 */
	public void setAddOnDesc(String addOnDesc) {
		this.addOnDesc = addOnDesc;
	}

	/**
	 * @return the addOnPrice
	 */
	public BigDecimal getAddOnPrice() {
		return addOnPrice;
	}

	/**
	 * @param addOnPrice the addOnPrice to set
	 */
	public void setAddOnPrice(BigDecimal addOnPrice) {
		this.addOnPrice = addOnPrice;
	}

	/**
	 * @return the applyMemberRank
	 */
	public String getApplyMemberRank() {
		return applyMemberRank;
	}

	/**
	 * @param applyMemberRank the applyMemberRank to set
	 */
	public void setApplyMemberRank(String applyMemberRank) {
		this.applyMemberRank = applyMemberRank;
	}

	/**
	 * @return the isEnable
	 */
	public String getIsEnable() {
		return isEnable;
	}

	/**
	 * @param isEnable the isEnable to set
	 */
	public void setIsEnable(String isEnable) {
		this.isEnable = isEnable;
	}

	/**
	 * @return the isDelete
	 */
	public String getIsDelete() {
		return isDelete;
	}

	/**
	 * @param isDelete the isDelete to set
	 */
	public void setIsDelete(String isDelete) {
		this.isDelete = isDelete;
	}

	/**
	 * @return the startDate
	 */
	public Date getStartDate() {
		return startDate;
	}

	/**
	 * @param startDate the startDate to set
	 */
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	/**
	 * @return the endDate
	 */
	public Date getEndDate() {
		return endDate;
	}

	/**
	 * @param endDate the endDate to set
	 */
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	/**
	 * @return the mainProductId
	 */
	public String getMainProductId() {
		return mainProductId;
	}

	/**
	 * @param mainProductId the mainProductId to set
	 */
	public void setMainProductId(String mainProductId) {
		this.mainProductId = mainProductId;
	}

	/**
	 * @return the addOnProductId
	 */
	public String getAddOnProductId() {
		return addOnProductId;
	}

	/**
	 * @param addOnProductId the addOnProductId to set
	 */
	public void setAddOnProductId(String addOnProductId) {
		this.addOnProductId = addOnProductId;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Product getAddProduct() {
		return addProduct;
	}

	public void setAddProduct(Product addProduct) {
		this.addProduct = addProduct;
	}
}
